From d1c6982eaadb0a333223cb45f0d599a0f2a142d2 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 1 Nov 2008 04:32:40 +0000 Subject: [PATCH] =?utf8?q?=20=20=20=20=20=20=20=20Bug=20322934=20=E2=80=93?= =?utf8?q?=20Replace=20menu's=20proxy=20icons=20with=20empty=20space=20hid?= =?utf8?q?ing=20icons?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding regardless of imagees or checks being in the menu. Also add padding on the right edge. Proposal by Luca Ferretti, patch by Jon McCann svn path=/trunk/; revision=21745 --- ChangeLog | 9 +++++++++ gtk/gtkmenu.c | 20 +++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index e2ba9b3e49..b7c292887a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-11-01 Matthias Clasen + + Bug 322934 – Replace menu's proxy icons with empty space hiding icons + + * gtk/gtkmenu.c (gtk_menu_size_request): Use consistent padding + regardless of imagees or checks being in the menu. Also add + padding on the right edge. + Proposal by Luca Ferretti, patch by Jon McCann + 2008-11-01 Matthias Clasen Bug 412134 – Add API to query style properties from the style diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index d97b785918..ad439c0a7e 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -31,6 +31,8 @@ #include "gtkaccellabel.h" #include "gtkaccelmap.h" #include "gtkbindings.h" +#include "gtkcheckmenuitem.h" +#include #include "gtkmain.h" #include "gtkmarshalers.h" #include "gtkmenu.h" @@ -2429,10 +2431,26 @@ gtk_menu_size_request (GtkWidget *widget, priv->heights[t] = MAX (priv->heights[t], part); } + /* if the menu doesn't include any images or check items + * reserve the space so that all menus are consistent */ + if (max_toggle_size == 0) + { + guint toggle_spacing; + guint indicator_size; + + gtk_style_get (widget->style, + GTK_TYPE_CHECK_MENU_ITEM, + "toggle-spacing", &toggle_spacing, + "indicator-size", &indicator_size, + NULL); + + max_toggle_size = indicator_size + toggle_spacing; + } + for (i = 0; i < gtk_menu_get_n_rows (menu); i++) requisition->height += priv->heights[i]; - requisition->width += max_toggle_size + max_accel_width; + requisition->width += 2 * max_toggle_size + max_accel_width; requisition->width *= gtk_menu_get_n_columns (menu); gtk_widget_style_get (GTK_WIDGET (menu), -- 2.30.2